<?php

declare(strict_types=1);

namespace Plugin\Attractions\Commerce\Model\Commerce_order_product;

use Hyperf\Database\Model\SoftDeletes;
use Hyperf\DbConnection\Model\Model;
use Plugin\Attractions\Commerce\Model\Commerce_commodity\CommerceCommodity;

/**
 * @property int $order_id 订单号
 * @property int $commodity_id 商品ID
 * @property string $commodity_name 商品名称
 * @property int $quantity 数量
 * @property string $price 单价
 * @property string $discount 折扣
 * @property string $reduction 满减
 * @property string $total_price 总价
 * @property array $photo 商品图片
 * @property array $commodity_spec 商品规格
 * @property string $commodity_unit 商品单位
 * @property \Carbon\Carbon $created_at 
 * @property \Carbon\Carbon $updated_at 
 * @property string $deleted_at 
 */
class CommerceOrderProduct extends Model
{
    use SoftDeletes;
    public bool $incrementing = false;
    protected string $primaryKey = 'order_id';
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'commerce_order_product';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['order_id', 'commodity_id', 'commodity_name', 'quantity', 'price', 'discount', 'reduction', 'total_price', 'photo', 'commodity_spec', 'commodity_unit', 'created_at', 'updated_at', 'deleted_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['order_id' => 'integer', 'commodity_id' => 'integer', 'quantity' => 'integer', 'commodity_spec' => 'array', 'photo' => 'array', 'price' => 'decimal:2', 'discount' => 'decimal:2', 'reduction' => 'decimal:2', 'total_price' => 'decimal:2', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    protected array $hidden = ['deleted_at'];
}
